﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace homework5
{
    public class Customer
    {

        public Customer()
        {
        }

        public Customer(int customerID,string name, string sex, int age, string tel)
        {
            CustomerId = customerID;
            Name = name;
            Sex = sex;
            Age = age;
            Tel = tel;
        }

        public int CustomerId
        {
            get;set;
        }
        public string Name
        {
            get;set;
        }
        public string Sex
        {
            get; set;
        }
        public int Age
        {
            get; set;
        }
        public string Tel
        {
            get; set;
        }

        public override bool Equals(object obj)
        {
            var customer = obj as Customer;
            return customer != null &&
                   CustomerId == customer.CustomerId &&
                   Name == customer.Name &&
                   Sex == customer.Sex &&
                   Age == customer.Age &&
                   Tel == customer.Tel;
        }

        public override int GetHashCode()
        {
            var hashCode = -687802753;
            hashCode = hashCode * -1521134295 + CustomerId.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Name);
            hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Sex);
            hashCode = hashCode * -1521134295 + Age.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Tel);
            return hashCode;
        }

        public override string ToString()
        {
            return Name;
        }
    }
}
